package com.jingdianjichi.subject.domain.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * ThreadPoolConfig 类
 *
 * @author 熊苏鹏1
 * @date 2025/3/9 14:42
 * @description 线程池设置
 */
@Configuration
public class ThreadPoolConfig {
    @Bean("labelThreadPool")
    public ThreadPoolExecutor labelThreadPool() {
        return new ThreadPoolExecutor(10,
                20,
                60,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(1000),
                new CustomNameThreadFactory("label"),
                new ThreadPoolExecutor.CallerRunsPolicy());
    }
}
